<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="${request.contextPath}/"/>
    <meta charset="UTF-8">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,minimum-scale=1.0">
    <title>漠河智慧社区</title>
    <link href="Content/wechat/css/reset.css" rel="stylesheet" type="text/css">
    <link href="Content/wechat/css/shengHuo_XXGQ.css" rel="stylesheet" type="text/css">


    <link href="Content/wechat/css/linLiSheQu.css" rel="stylesheet" type="text/css">

    <script src="Content/wechat/js/jquery.min.js"></script>
    <!--字体缩放-->
    <script src="Content/wechat/js/ziti.js"></script>
    <!--end 字体缩放-->
    <!--页码js-->
    <script src="Content/wechat/js/myPagination.js"></script>
    <!--页码-->
    <link href="Content/wechat/css/myPagination.css" rel="stylesheet" type="text/css">
</head>
<body>
<!--header-->

<!--我的社区-->
<div class="woDeSheQu">
    <ul class="woDeSheQu_box">
        <li>
            <a href="/wechat/forum/findJob">
                <img src="Content/wechat/images/q_1.png">
                <span>求职招聘</span>
            </a>
        </li>
        <li>
            <a href="/wechat/forum/goodBuy">
                <img src="Content/wechat/images/q_2.png">
                <span>物品买卖</span>
            </a>
        </li>
        <li>
            <a href="/wechat/forum/houseBuy">
                <img src="Content/wechat/images/q_3.png">
                <span>房屋租售</span>
            </a>
        </li>
        <li>
            <a href="/wechat/forum/peopleHelp">
                <img src="Content/wechat/images/q_4.png">
                <span>居民求助</span>
            </a>
        </li>
    </ul>
</div>
<div class="liuYan">
    <div class="liuYan_box" id="liuYan_box">
        <div class="liuYan_box_1">
            <div class="name_up clearfix">
                <img src="Content/wechat/images/header.jpg">
                <p>Hello</p>
                <span class="v"></span>
                <u>2019-12-02</u>
            </div>
            <div class="neiRong_c" onclick=window.location="/wechat/forum/tongCheng_xx">
                <h4>漠河是大兴安岭地区县级市</h4>
                <p>近期计划去漠河旅游，我打算带上我一家人（四大一小）去玩玩，问下去玩几天比较合适，请问去过的要怎么样玩比较省心省钱少走弯路</p>
            </div>
            <div class="fenLei_down">
                <span class="wpmm">居民求助</span>
            </div>
        </div>

    </div>
    <!--页码-->
    <div id="pagination" class="pagination"></div>


    <!--end 页码-->

</div>

</body>
<script>
    var pageTotal = 0;   //总页数
    var pageSize = 5;    //一页显示几个
    window.onload = function () {
        InitAjax(1);
    }

    function onLoadPaging() {
        new myPagination({
            id: 'pagination',
            curPage: 1, //初始页码
            pageTotal: pageTotal, //总页数
            pageAmount: pageSize,  //每页多少条
            pageSize: 2, //可选,分页个数

            getPage: function (page) {
                //获取当前页数
                InitAjax(page)
            }
        })
    }

    function InitAjax(pageNum) {
        $.ajax({
            url: "/wechat/forum/list",
            type: 'post',
            dataType: 'json',
            data: {
                pagination: "{page:\"" + pageNum + "\",rows:\"" + pageSize + "\",sidx:\"\",sord:\"\"}",
                type: ""
            }, success: function (result) {
                ajaxCallBack(result);
            }

        })
    }

    function ajaxCallBack(data) {
        var insetViewData = ""; //视图数据
        $.each(data.data.rows, function (index, items) {
            var imgUrl = items.imgUrl;
            if (imgUrl != null && (items.type == '新鲜随拍')) {
                var imgUrl_arr = imgUrl.split(",");
                insetViewData += "<div class=\"liuYan_box_1\">\n" +
                    "            <div class=\"name_up clearfix\">\n" +
                    "                <img src=\"" + items.headimgurl + "\">\n" +
                    "                <p>" + items.nickname + "</p>\n" +
                    // "                <span class=\"v\"></span>\n" +
                    "                <u>" + items.date + "</u>\n" +
                    "            </div>\n" +
                    "            <div class=\"neiRong_c\" onclick=window.location=\"/wechat/forum/fornum_info?id=" + items.id + "\">\n" +
                    "                <img src=\"" + imgUrl_arr[0] + "\">\n" +
                    "            </div>\n" +
                    "            <div class=\"fenLei_down\">\n" +
                    "\n" +
                    "                <span class=\"xxsp\">新鲜随拍</span>\n" +
                    "            </div>\n" +
                    "        </div>";
            } else {
                insetViewData += "<div class=\"liuYan_box_1\">\n" +
                    "            <div class=\"name_up clearfix\">\n" +
                    "                <img src=\"" + items.headimgurl + "\">\n" +
                    "                <p>" + items.nickname + "</p>\n" +
                    // "                <span class=\"v\"></span>\n" +
                    "                <u>" + items.date + "</u>\n" +
                    "            </div>\n" +
                    "            <div class=\"neiRong_c\" onclick=window.location=\"/wechat/forum/fornum_info?id=" + items.id + "\">\n" +
                    "                <h4>" + items.title + "</h4>\n" +
                    "                <p>" + items.content + "</p>\n" +
                    "            </div>\n" +
                    "            <div class=\"fenLei_down\">\n" +
                    typeCss(items.type) +
                    "            </div>\n" +
                    "        </div>";
            }
        });
        $("#liuYan_box").html(insetViewData);
        if (pageTotal == 0) {
            pageTotal = data.data.total;
            onLoadPaging()
        }
    }

    function typeCss(type) {
        var typeHtml = "";
        if (type == "同城交友") {
            typeHtml = " <span class=\"tcjy\">同城交友</span>";
        }
        if (type == "大事小情") {
            typeHtml = "  <span class=\"dsxq\">大事小情</span>";
        }
        if (type == "新鲜随拍") {
            typeHtml = " <span class=\"xxsp\">新鲜随拍</span>";
        }
        if (type == "求职招聘") {
            typeHtml = "<span class=\"wpmm\">求职招聘</span>";
        }

        if (type == "物品买卖") {
            typeHtml = "<span class=\"wpmm\">物品买卖</span>";
        }
        if (type == "房屋租售") {
            typeHtml = "<span class=\"wpmm\">房屋租售</span>";
        }

        if (type == "居民求助") {
            typeHtml = " <span class=\"wpmm\">居民求助</span>";
        }
        return typeHtml;

    }

</script>
</html>